package cn.funeralobjects.minecraft.api;

import cn.funeralobjects.minecraft.api.mapper.ServerMapper;
import cn.funeralobjects.minecraft.api.model.ServerVo;
import cn.funeralobjects.minecraft.service.MinecraftServerService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

/**
 * @author FuneralObjects
 * Create date: 2021/5/5 11:08 PM
 */
@RestController
@RequestMapping("/api/server")
public class ServerApi {

    @Resource
    private MinecraftServerService minecraftServerService;

    @GetMapping("/verbose")
    public Mono<ServerVo> getServer() {
        return minecraftServerService.getServer().map(ServerMapper.INSTANCE::toVo);
    }
}
